<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <title>修改密码</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="keywords" content="Hosting Store Responsive web template, Bootstrap Web Templates, Flat Web Templates, Andriod Compatible web template,
Smartphone Compatible web template, free webdesigns for Nokia, Samsung, LG, SonyErricsson, Motorola web design" />
    <script type="application/x-javascript"> addEventListener("load", function() { setTimeout(hideURLbar, 0); }, false); function hideURLbar(){ window.scrollTo(0,1); } </script>

    <%--<link href="${pageContext.request.contextPath}/static/admin/assets/css/minimal.css" rel="stylesheet"/>--%>
    <%--<link href="${pageContext.request.contextPath}/static/admin/assets/css/vendor/bootstrap/bootstrap.min.css" rel="stylesheet"/>--%>
    <link href="${pageContext.request.contextPath}/static/home/css/bootstrap.css" rel='stylesheet' type='text/css' />

    <script src="${pageContext.request.contextPath}/static/home/js/jquery-1.11.1.min.js"></script>
    <%--<script src="${pageContext.request.contextPath}/static/admin/assets/js/vendor/bootstrap/bootstrap.min.js"></script>--%>
    <!-- Custom Theme files -->
    <link href="${pageContext.request.contextPath}/static/home/css/style.css" rel='stylesheet' type='text/css' />
    <!-- Custom Theme files -->

    <!-- webfonts -->
    <link href='${pageContext.request.contextPath}/static/home/css/font-awesome.css' rel='stylesheet' type='text/css'/>
    <!-- webfonts -->
    <!-- dropdown -->
    <script src="${pageContext.request.contextPath}/static/home/js/jquery.easydropdown.js"></script>
    <script src="${pageContext.request.contextPath}/static/home/js/jquery-labelauty.js"></script>

    <link href="${pageContext.request.contextPath}/static/home/css/nav.css" rel="stylesheet" type="text/css" media="all"/>
    <link href="${pageContext.request.contextPath}/static/home/css/jquery-labelauty.css" rel='stylesheet' type='text/css' />
    <link href="${pageContext.request.contextPath}/static/home/css/passwordStyle.css" rel='stylesheet' type='text/css' />
    <link href="${pageContext.request.contextPath}/static/admin/css/sweetalert.css" rel="stylesheet">

    <!-- start-smoth-scrolling -->
    <script type="text/javascript" src="${pageContext.request.contextPath}/static/home/js/move-top.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/static/home/js/easing.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/static/home/js/bootstrapValidator.min.js"></script>

    <script src="${pageContext.request.contextPath}/static/admin/js/sweetalert.min.js"></script>

    <script type="text/javascript">
        jQuery(document).ready(function($) {
            $(".scroll").click(function(event){
                event.preventDefault();
                $('html,body').animate({scrollTop:$(this.hash).offset().top},1000);
            });
        });
    </script>
    <!-- end-smoth-scrolling -->
    <style>
        small{
            position: relative;
            top: -32px;
            left:97%;
        }
        .msg{
            color: #a94442;
        }
    </style>
</head>
<!-- Header Starts Here -->
<div class="banner inner-banner" >

    <%@include file="../header.jsp"%>

    <div id="breadcrumb_wrapper">
        <div class="container">

            <h3>修改密码</h3>
            <h6>&nbsp;</h6>

            <div class="clearfix"></div>
        </div>
    </div>
</div>
<div class="clearfix"> </div>
<!-- Header Ends Here -->
<!--Main Starts Here-->
<div class="register-content">
    <div class="container">
        <div class="register register-but">
            <form class="form-company" action="${pageContext.request.contextPath}/home/company/savePsd.action" method="post">
                <input type="text" name="company_id" style="display: none" value="${company.company_id}">
                <div class="register-top-grid ">
                    <h3>修改密码</h3>
                    <div class="wow fadeInLeft form-group" data-wow-delay="0.4s">
                        <span>原密码<label>*</label></span>
                        <input type="password" name="old_password" value="<c:if test="${old_password != null}">${old_password}</c:if>">
                        <c:if test="${msg == 1}">
                            <p class="msg">原密码不能为空！</p>
                        </c:if>
                        <c:if test="${msg == 5}">
                            <p class="msg">原密码输入不正确！</p>
                        </c:if>
                    </div>
                </div>
                <div class="register-bottom-grid ">
                    <div class="wow fadeInLeft form-group" data-wow-delay="0.4s">
                        <span>新密码<label>*</label></span>
                        <input type="password" name="password" value="<c:if test="${company.password != null}">${company.password}</c:if>">
                        <c:if test="${msg == 2}">
                            <p class="msg">新密码输入不正确！</p>
                        </c:if>
                    </div>
                    <div class="clearfix"></div>
                    <div class="wow fadeInRight form-group" data-wow-delay="0.4s">
                        <span>确认密码<label>*</label></span>
                        <input type="password" name="confirm_password" value="<c:if test="${confirm_password != null}">${confirm_password}</c:if>">
                        <c:if test="${msg == 3}">
                            <p class="msg">确认密码不能为空！</p>
                        </c:if>
                        <c:if test="${msg == 4}">
                            <p class="msg">两次密码输入不正确！</p>
                        </c:if>
                    </div>
                </div>
                <div class="clearfix"> </div>
                <div class="register-but">
                    <input type="submit" value="确认">
                </div>

            </form>

        </div>
    </div>
</div>
<!--Main Ends Here-->


<!-- #Footer -->
<%@include file="../footer.jsp"%>
<!-- /#Footer -->
<!-- here stars scrolling icon -->
<script type="text/javascript">

    <c:if test="${error == 1}">
    swal("","服务器出错！","error");
    </c:if>
    <c:if test="${success == 1}">
    swal({
        title: "",
        text: "修改成功！",
        type: "success",
        showCancelButton: false,
        closeOnConfirm: true,
        confirmButtonText: "确定"
    }, function() {
        window.location.href="${pageContext.request.contextPath}/";
    });
    setTimeout(function(){
        window.location.href="${pageContext.request.contextPath}/";
    },3000);
    </c:if>
    $(document).ready(function() {
        /*
         var defaults = {
         containerID: 'toTop', // fading element id
         containerHoverID: 'toTopHover', // fading element hover id
         scrollSpeed: 1200,
         easingType: 'linear'
         };
         */

        $().UItoTop({ easingType: 'easeOutQuart' });

    });

</script>

<script>
    $(function(){
        $('.form-group').data('bootstrapValidator', null);
        $('.fadeInRight').each(function (e) {
            if($(this).hasClass('has-success')){
                $(this).removeClass('has-success');
            }
            if($(this).hasClass('has-error')){
                $(this).removeClass('has-error');
            }
        });
        $('.form-company').bootstrapValidator({
            message: 'This value is not valid',
            fields: {
                old_password: {
                    message: 'The username is not valid',
                    validators: {
                        notEmpty: {
                            message: '请填写旧密码'
                        },
                        stringLength: {
                            min: 6,
                            max: 30,
                            message: '建议密码为6位以上字符（字母、数字、符号)组合而成'
                        },
                        remote:{
                            message:"原密码输入不正确！",
                            url:'${pageContext.request.contextPath}/checkOldPasswordCompany.action',
                        }
                    }
                },
                password: {
                    message: 'The username is not valid',
                    validators: {
                        notEmpty: {
                            message: '请填写新密码'
                        },
                        stringLength: {
                            min: 6,
                            max: 30,
                            message: '建议密码为6位以上字符（字母、数字、符号)组合而成'
                        }
                    }
                },
                confirm_password: {
                    message: 'The username is not valid',
                    validators: {
                        notEmpty: {
                            message: '请填写密码'
                        },
                        identical:{
                            field:'password',
                            message:'两次密码输入不一致'
                        }
                    }
                }
            }
        });
    });
</script>
<!-- //here ends scrolling icon -->
</body>
</html>
